﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.PolicyInjection;
using WinnerCMS.Common;
using WinnerCMS.Model;
using WinnerCMS.Model.Attribute;

#endregion

namespace WinnerCMS.WebUI.Admin.Admin
{
    [Access("268002")]
    public partial class Add : Page
    {
        private readonly BLL.AdminManage _myBll = PolicyInjection.Create<BLL.AdminManage>();

        protected void Page_Load(object sender, EventArgs e)
        {
            this.btnAddAdmin.Attributes.Add("onclick", "return CheckPSW2();");
        }

        protected void btnAddAdmin_Click(object sender, EventArgs e)
        {
            var model = new User
            {
                UserName = this.txtUserName.Text,
                PassWord = this.txtPassword1.Text
            };
            var res = this._myBll.Add(model);
            if (res.Errors.Length == 0)
            {
                MsgBox.Message("添加成功！", this);
            }
            else
            {
                MsgBox.Message(res.Errors, this);
            }
        }
    }
}